package cn.com.bluemoon.daps.standard.service.impl;

import cn.com.bluemoon.daps.common.exception.DapException;
import cn.com.bluemoon.daps.standard.entity.DapAuditSystemResult;
import cn.com.bluemoon.daps.standard.mapper.DapAuditSystemResultMapper;
import cn.com.bluemoon.daps.standard.service.DapAuditSystemResultService;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 系统稽核结果表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2020-08-03
 */
@Slf4j
@Service
@Transactional(rollbackFor = {DapException.class, Exception.class})
public class DapAuditSystemResultServiceImpl extends ServiceImpl<DapAuditSystemResultMapper, DapAuditSystemResult> implements DapAuditSystemResultService {

    /**
     * 更新
     *
     * @param id     稽核结果id
     * @param isPass 是否通过
     */
    @Override
    public void updateCheckResultById(String id, boolean isPass) {
        LambdaUpdateWrapper<DapAuditSystemResult> update = bmLambdaUpdate()
                .eq(DapAuditSystemResult::getId, id)
                .set(DapAuditSystemResult::getCheckResult, isPass ? 1 : 0);
        update(update);
    }

}
